home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Letter.h
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __LETTER__
- #define __LETTER__
-
- #ifndef __BLJSTANDARDINCLUDES__
- #include "BLJStandardIncludes.h"
- #endif
-
- #ifndef __COREGATEWAYTYPES__
- #include "CoreGatewayTypes.h"
- #endif
-
- #ifndef __RECIPIENT__
- #include "Recipient.h"
- #endif
-
- class ostream;
- class TVirtualFolder;
-
- /***********************************|****************************************/
-
- class TLetter : public THandleObject
- {
- public:
- virtual ~TLetter();
-
- //
- // LETTER HEADER METHODS
- // =====================
- //
- // LetterID Methods: Each letter should support the GetLetterID method. A LetterID
- // is a key which MUST uniquely identify a letter. A letter does not need to have
- // a letterID. A ReplyID may exists in a letter. If it does, then (by convention)
- // this letter is a reply to a previous letter and the replyID is the letterID of
- // the original letter. Currently the conversationID does not have a well accepted
- // meaning.
- virtual Boolean GetLetterID (BLJLetterID&) const = 0;
- virtual Boolean GetReplyID (BLJLetterID&) const = 0;
- virtual Boolean GetConversationID (BLJLetterID&) const = 0;
-
- // The time that the letter was 'sent'. This should be as close to the time that
- // the user actually sent the letter as possible, but should be 'authenticated' in
- // some way which the sender should not be able to 'fake'. Typically, in a system
- // where server machines accept and route mail, this will be the time the letter was
- // received from the user onto the first server. In some cases, this time may differ
- // signifigantly from the time when the user actually sent the letter. If no time
- // is given in the letter, then the receiving mail gateway may insert the current time
- // or do something else if a send time is necessary.
- virtual Boolean GetSendTimeStamp (BLJTime& sendTime) const = 0;
-
- // Letters may contain a priority. There is no guarentee that any mail gateway
- // will respect the priority in a letter.
- enum LetterPriority { noPriority, lowPriority, highPriority };
- virtual Boolean GetLetterPriority (LetterPriority& priority) const = 0;
-
- // A letter should contain a subject, but it does not have to have one.
- virtual Boolean GetSubject (TRString& subject) const = 0;
-
- // Letters may be automatically forwarded or automatically replied to by some
- // destination mail systems. If this is supported by the originating mail
- // system, then these functions will return the appropriate booleans indicating
- // whether this has happened for this letter. Similarly, some letters can carry
- // attributes controlling their distribution. If these attributes are present,
- // the Can… methods indicate which attribute values exist in this letter.
- virtual Boolean IsLetterAutoForwarded (Boolean& yesItIs) const = 0;
- virtual Boolean IsLetterAutoReply (Boolean& yesItIs) const = 0;
- virtual Boolean CanLetterBeAutoForwarded (Boolean& yesItCan) const = 0;
- virtual Boolean LetterIsCompleted ();
-
- //
- // LETTER RECIPIENTS
- // =================
- //
- // A letter MUST contain at least one recipient. Recipients fall into one of
- // several types: fromRecipient, toRecipient, ccRecipient, and bccRecipient.
- // Each of these recipients is distinct. Each recipient represents a singe
- // 'address', which may represent a single user or a group of users; and each
- // recipient is one for which the half gateway receiving this letter is either
- // responsible for delivering a letter to or not.
- virtual unsigned short GetRecipientCount(RecipientTypeSet recipientType) const = 0;
- virtual TRecipient* GetRecipient (RecipientTypeSet recipientType, unsigned short index) const = 0;
-
- //
- // RECIPIENT REPORTS METHODS
- // =========================
- //
- // These functions deal with reporting on the 'status' for an individual recipient.
- // The recieving mail system should use these functions to report back the status for those
- // recipients for which status was requested (see the calls below). Each recipient for which
- // the destination half gateway is responsible should be reported on.
- virtual Boolean GetRecipientStatus(RecipientTypeSet, unsigned short index, RecipientStatusSet&) const = 0;
- virtual Boolean SetRecipientStatus(RecipientTypeSet, unsigned short index, RecipientStatusSet) = 0;
-
- // GetUnknownRecipientCount() is a short-hand way of determining the number of recipients
- // with the status cUnknown for which the destination half gateway is responsible. This is
- // important because when this value falls to zero, all recipients which the half gateway
- // was responsible for have been discharged, and so the destination half gateway does not
- // need to keep track of this letter any longer.
- virtual unsigned short GetUnknownRecipientCount() const = 0;
-
- // These routines return booleans related to the reports requested about this letter.
- virtual Boolean DeliveryReceiptRequested(Boolean &yesItIs) const = 0;
- virtual Boolean NonDeliveryReportRequested (Boolean& yesItIs) const = 0;
-
- //
- // LETTER CONTENT METHODS
- // ======================
- //
- // A letter's content consists of several parts: First, there are a sequence
- // of segments, numbered from 1… GetSegmentCount(). Each segment is a certain
- // type of data, indicated by the blockType returned by GetSegmentInfo(). Certain
- // types have a well known format - 'TEXT' represents simple ASCII text, 'stxt' is
- // styled text, 'snd ' is a sampled sound, and there are others which are not described
- // herein. A half gateway should support (at the minimum) the 'TEXT' and 'stxt' type.
- // A letter may contain no segment blocks.
- // These deal with the content of the message
- virtual unsigned long GetContentTypeCount ( ) const = 0;
- virtual OSType GetContentType ( unsigned long i ) const = 0;
-
- virtual unsigned long GetSegmentCount( OSType contentType ) const = 0;
- virtual Boolean GetSegmentData( OSType contentType, unsigned long index, unsigned long offset,void *data, long& maximumDataSize ) const = 0;
- virtual Boolean GetSegmentInfo( OSType contentType, unsigned long index, BLJLetterBlockType& blockType, long& blockLength ) const = 0;
-
- // A letter may also contain any number of 'enclosed' Macintosh files, in a hierarchy
- // of files and folders. If a letter contains enclosures, then a TVirtualFolder will
- // be returned, and this folder will contain the files and folders which are 'enclosed'
- // in this letter. This 'magic' folder which is returned is not itself in the letter.
- // If this letter contains no enclosures, then GetEnclosuresFolder() will return nil.
- virtual TVirtualFolder* GetEnclosuresFolder() const = 0;
-
- // Each letter may contain a number of 'nested' letters. GetNestedLetterCount() will
- // return the count of the letters available, and GetNestedLetter(i) will return the
- // i-th nested letter at the current level. Note that although all of the letter
- // methods will return data for the nested letter, nested letters are NOT exactly the
- // same as the 'top level' letter. The recipients in nested letters are never recipients
- // for which the destination half gateway could be responsible for.
- virtual unsigned short GetNestedLetterCount() const = 0;
- virtual TLetter* GetNestedLetter(unsigned short index) const = 0;
-
- //
- // MISCELLANEOUS METHODS
- // =====================
- //
- // A letter (obviously) occupies a chunk of memory and other resources. Some of this
- // usage may be for convinience or speed reasons. The Minimize() method may 'free' up
- // some of this memory usage. This method may do nothing.
- virtual void Minimize();
-
- //
- // DEBUGGING METHODS
- // =================
- //
- virtual ostream& Describe(ostream& s) const; // Display info about object, calls DescribeSubclass()
- virtual ostream& DescribeSubclass(ostream& s) const; // Display specific info about object, should override
- virtual ostream& operator >> ( ostream& ) const;
-
- /***********************************|****************************************/
-
- static Boolean SetAllUnknownRecipientStatus ( TLetter* letter, const RecipientStatusSet& status );
-
- protected:
- TLetter(); // default constructor
- };
-
- /***********************************|****************************************/
-
- #endif // __LETTER__
-